﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SdmxMl.Structure
{
    /// <summary>
    /// provides an enumeration of all objects.
    /// </summary>
    public enum ObjectTypeCodelistType
    {
        Any,
        Agency,
        AgencyScheme,
        AttachmentConstraint,
        AttributeDescriptor,
        Attribute,
        Categorisation,
        CategorySchemeMap,
        CategoryScheme,
        Category,
        Code,
        CodelistMap,
        Codelist,
        ConceptSchemeMap,
        ConceptScheme,
        Concept,
        ContentConstraint,
        Dataflow,
        DataConsumer,
        DataConsumerScheme,
        DataProvider,
        DataProviderScheme,
        DataSetTarget,
        DataStructure,
        Dimension,
        GroupKeyDescriptor,
        HierarchicalCode,
        HierarchicalCodelist,
        IdentifiableObjectTarget,
        KeyDescriptor,
        KeyDescriptorValuesTarget,
        Level,
        LevelBasedHierarchy,
        MeasureDescriptor,
        MeasureDimension,
        Metadataflow,
        MetadataAttribute,
        MetadataSet,
        MetadataTarget,
        MetadataStructure,
        OrganisationSchemeMap,
        OrganisationUnit,
        OrganisationUnitScheme,
        PrimaryMeasure,
        Process,
        ProcessStep,
        ProvisionAgreement,
        ReportingCategory,
        ReportingTaxonomy,
        ReportingTaxonomyMap,
        ReportPeriodTarget,
        ReportStructure,
        StructureMap,
        StructureSet,
        TimeDimension,
        Transition,
        ValueBasedHierarchy,

    }

    public class ObjectTypeConverter
    {

        public static ObjectIDType ToObjectIDType(ObjectTypeCodelistType ot)
        {
            ObjectIDType o = ObjectIDType.Attribute;

            // Convert to old SDMX 2.0 types


            return o;
        }

        public static ObjectTypeCodelistType ToObjectTypeCodelistType(string str)
        {
            ObjectTypeCodelistType o = ObjectTypeCodelistType.Any;
          //  ObjectIDType oidt = ObjectIDType.Attribute;
            /*
            if (Enum.IsDefined(typeof(ObjectIDType), str))
                oidt = (ObjectIDType)Enum.Parse(typeof(ObjectIDType), str, true);
            else
                throw new ApplicationException("Unrecognised ObjectIDType: " + str);

            // Now convert to SDMX 2.1 types
            switch (oidt)
            {
                case ObjectIDType.Agency:               o = ObjectTypeCodelistType.Agency; break;
                case ObjectIDType.AttachmentConstraint: o = ObjectTypeCodelistType.AttachmentConstraint; break;
                case ObjectIDType.Attribute:            o = ObjectTypeCodelistType.Attribute; break;
                case ObjectIDType.AttributeDescriptor:  o = ObjectTypeCodelistType.AttributeDescriptor; break;


                case ObjectIDType.Category:             o = ObjectTypeCodelistType.Category; break;
                case ObjectIDType.CategoryMap:          o = ObjectTypeCodelistType.Categorisation; break;
                case ObjectIDType.CategoryScheme:       o = ObjectTypeCodelistType.CategoryScheme; break;
                case ObjectIDType.CategorySchemeMap:    o = ObjectTypeCodelistType.CategorySchemeMap; break;
                case ObjectIDType.Code:                 o = ObjectTypeCodelistType.Code; break;
                case ObjectIDType.Codelist:             o = ObjectTypeCodelistType.Codelist; break;
                case ObjectIDType.CodelistMap:          o = ObjectTypeCodelistType.CodelistMap; break;
                case ObjectIDType.CodeMap:              o = ObjectTypeCodelistType.Any; break;
                case ObjectIDType.Component:            o = ObjectTypeCodelistType.Any; break;
                case ObjectIDType.ComponentMap:         o = ObjectTypeCodelistType.Any; break;
                case ObjectIDType.Concept:              o = ObjectTypeCodelistType.Concept; break;
                case ObjectIDType.ConceptMap:           o = ObjectTypeCodelistType.Concept; break;
                case ObjectIDType.ConceptScheme:        o = ObjectTypeCodelistType.ConceptScheme; break;
                case ObjectIDType.ConceptSchemeMap:     o = ObjectTypeCodelistType.ConceptSchemeMap; break;
                case ObjectIDType.AttributeDescriptor: o = ObjectTypeCodelistType.AttributeDescriptor; break;
                case ObjectIDType.AttributeDescriptor: o = ObjectTypeCodelistType.AttributeDescriptor; break;
                case ObjectIDType.AttributeDescriptor: o = ObjectTypeCodelistType.AttributeDescriptor; break;
            
            }
            */

            return o;
        }

    
    }

}
